<?php

use Biz\service\advertisement\spotlight\SpotlightActivityService;

ini_set('display_errors', 1);
error_reporting(-1);
require_once '/data/wwwroot/g_vendor/autoload.php';


echo <<<CODE
======== 参数列表 =========
cache 查看所有缓存
subscribe 查看订阅情况
nextSubscribe 查看预定下次幸运情况
open 查看打开盒子情况
guess 查看猜一猜情况
features 查看新品打call情况
init 初始化缓存
log 查看日志
monitoring 监控日志
uid {uid} 用户信息
======== end =========
CODE, PHP_EOL;

$action = $argv[1] ?? '';
$p = $argv[2] ?? 1;

switch ($action) {
    case 'cache':
        $cache = SpotlightActivityService::getActivity($p)->allCache();
        print_r($cache);
        break;
    case 'subscribe':
        $uids = SpotlightActivityService::getActivity($p)->allSubscribe();
        echo "订阅人数:", count($uids), PHP_EOL;
        echo "订阅uid:", implode(',', $uids), PHP_EOL;
        break;
    case 'nextSubscribe':
        $uids = SpotlightActivityService::getActivity($p)->allNextSubscribe();
        echo "订阅人数:", count($uids), PHP_EOL;
        echo "订阅uid:", implode(',', $uids), PHP_EOL;
        break;
    case 'open':
        $uids = SpotlightActivityService::getActivity($p)->allOpen();
        echo "打开盒子人数:", count($uids), PHP_EOL;
        echo "打开盒子uid:", implode(',', $uids), PHP_EOL;
        break;
    case 'guess':
        SpotlightActivityService::getActivity($p)->showAllGuess();
        break;
    case 'features':
        SpotlightActivityService::getActivity($p)->showAllLikeFeatures();
        break;
    case 'log':
        break;
    case 'init':
        SpotlightActivityService::getActivity($p)->clearAllCache();
        echo ('初始化成功');
        break;
    case 'monitoring':
        SpotlightActivityService::getActivity($p)->monitoring();
        break;
}

